﻿package com.wly.ui
{
	import com.wly.ui.common.BaseSprite;
	import com.wly.ui.common.GlobalInfo;
	
	import flash.display.Sprite;
	import flash.text.TextField;
	
	import flashx.textLayout.tlf_internal;
	
	public class PlayerInfo extends BaseSprite
	{
		private var _tfScore:TextField;
		private var _tfRmb:TextField;
		
		public function PlayerInfo()
		{
			super();
			
			_tfScore = getChildByName("tfScore") as TextField;
			_tfRmb   = getChildByName("tfRmb") as TextField;
		}
		
		public function set playerScore(val:int):void
		{
			if(_tfScore)
			{
				_tfScore.text = val.toString();
			}
		}
		
		public function set rmb(val:int):void
		{
			if(_tfRmb)
			{
				_tfRmb.text = val.toString();
			}
		}
		
		public function set playerLifeNum(val:int):void
		{
			var i:int;
			var lifeflag:Sprite
			for(i=0; i<5; i++)
			{
				lifeflag = getChildByName("mcLife"+i.toString()) as Sprite;
				if(lifeflag)
				{
					if((i+1)<=val)
					{
						lifeflag.visible = true;
					}
					else
					{
						lifeflag.visible = false;
					}
				}
			}
		}
	}
}